<html>
	<head>
		<script src="js/jquery-1.8.2.min.js" type="text/javascript"></script>

<script type="text/javascript" src="js/jquery.validate.js"></script>
<script type="text/javascript" src="js/register.jquery.js"></script>
<script type="text/javascript" src="js/jquery.form.min.js"></script>
	</head>

	<body>
<?php
if(!isset($_REQUEST['id'])){
		?>
	<form name="register" id="myForm" method="post" action="ins.php" enctype="multipart/form-data">
  <table border="1px" align="center">

    <thead>
      <tr >
        <th colspan="3">Insert New record</th>
      </tr>
    </thead>

    <tbody>

      <tr>
        <td align="right" width="20%">Name :</td>
        
        <td width="40%">
<input
type="text"
name="uname"
placeholder="My Name is..." />
        </td>
        <td width="40%"><label for="uname" generated="true" class="error"></label></td>
      </tr>

      <tr>
        <td align="right">Email :</td>
        <td >
<input type="email"
       name="email"
       placeholder="My email is..." />        </td>
         <td><label for="email" generated="true" class="error"></label></td>
      </tr>
      
      <tr>
        <td align="right">Mobile :</td>
        <td >
<input type="tel"
       name="mobile"
       placeholder="My Mobile is..." />        </td>
         <td><label for="mobile" generated="true" class="error"></label></td>
      </tr>
      
      

      <tr>
        <td align="right">Password :</td>
        <td >
<input type="password"
       name="password"
       id="passwordId"
       placeholder="My password is..." />        </td>
         <td><label for="passwordId" generated="true" class="error"></label></td>
      </tr>

      <tr>
        <td align="right">Confirm Password :</td>
        <td >
<input type="password"
       name="c_password"
       placeholder="My password is..." />        </td>
         <td><label for="c_password" generated="true" class="error"></label></td>
      </tr>

      <tr>
        <td align="right">Gender :</td>
        <td >
<span>
<label><input type="radio"
       name="gender" value="Male"
        /> Male</label>
<label><input type="radio"
       name="gender" value="Female"
        /> Female</label>
</span>


        </td>
         <td><label for="gender" generated="true" class="error"></label></td>
      </tr>

      <tr>
        <td align="right">Date Of Birth :</td>
        <td >
<input type="date"
       name="dob"
       placeholder="My DOB is..." />        </td>
         <td><label for="dob" generated="true" class="error"></label></td>
      </tr>




      <tr>
        <td align="right">Address :</td>
        <td >
<textarea name="address"
          placeholder="My address is"
></textarea>
          </td>
           <td><label for="address" generated="true" class="error"></label></td>
      </tr>
      <tr>
        <td align="right">&nbsp;</td>
        <td >
<label><input type="checkbox"
       name="agree"
       /> Are you agree ?</label></td>
        <td><label for="agree" generated="true" class="error"></label></td>
      </tr>

      <tr>
          <td align="right">&nbsp;</td>
        <td >
        	<input type="submit" name="submit" value="submit" id="submit" />
</button> </td>
         <td align="right">&nbsp;</td>
      </tr>

    </tbody>

  </table>
</form>
<?php }else{
require 'db.php';
$id=$_REQUEST['id'];
$sql=mysql_query("select * from records where id='$id'")or die(mysql_error());
$data=mysql_fetch_assoc($sql);
?>
	<form name="register" id="myForm" method="post" action="ed.php" enctype="multipart/form-data">
  <table border="1px" align="center">

    <thead>
      <tr >
        <th colspan="3">Update Record For id <?=$_REQUEST['id']?></th>
      </tr>
    </thead>

    <tbody>

      <tr>
      	<input type="hidden" name="id" value="<?=$_REQUEST['id']?>" />
        <td align="right" width="20%">Name:</td>
        
        <td width="40%">
		<input
		type="text"
		name="uname"
		value="<?=$data['name']?>"
		placeholder="My Name is..." />
        </td>
        <td width="40%"><label for="uname" generated="true" class="error"></label></td>
      </tr>

      <tr>
        <td align="right">Email :</td>
        <td >
		<?=$data['email']?>
       </td>
         <td><label for="email" generated="true" class="error"></label></td>
      </tr>
      
      <tr>
        <td align="right">Mobile :</td>
        <td >
		<input type="tel"
       name="mobile"
       value="<?=$data['mobile']?>"
       placeholder="My Mobile is..." />        </td>
         <td><label for="mobile" generated="true" class="error"></label></td>
      </tr>
      
      

      

      <tr>
        <td align="right">Gender :</td>
        <td >
		<span>
		<label><input type="radio"
       name="gender" value="Male"
       <?php
        if($data['gender'] == 'Male'){?>
        	checked="checked"
        	<?php       	
        }
        ?>
        /> Male</label>
		<label><input type="radio"
       name="gender" value="Female"
       <?php
        if($data['gender'] == 'Female'){?>
        	checked="checked"
        	<?php       	
        }
        ?>
        /> Female</label>
		</span>


        </td>
         <td><label for="gender" generated="true" class="error"></label></td>
      </tr>

      <tr>
        <td align="right">Date Of Birth :</td>
        <td >
		<input type="date"
       name="dob"
       value="<?=$data['dob']?>"
       placeholder="My DOB is..." />        </td>
         <td><label for="dob" generated="true" class="error"></label></td>
      </tr>




      <tr>
        <td align="right">Address :</td>
        <td >
		<textarea name="address"
          placeholder="My address is"
          
		><?=$data['address']?></textarea>
          </td>
           <td><label for="address" generated="true" class="error"></label></td>
      </tr>
      <tr>
        <td align="right">&nbsp;</td>
        <td >
<label><input type="checkbox"
       name="agree"
       /> Are you agree ?</label></td>
        <td><label for="agree" generated="true" class="error"></label></td>
      </tr>

      <tr>
          <td align="right">&nbsp;</td>
        <td >
        	<input type="submit" name="submit" value="submit" id="submit" />
		</button>
		<a href="#" id="cencel">Cencel Upadte</a>
		</td>
         <td align="right">&nbsp;</td>
      </tr>
	<script type="text/javascript">
		$("#cencel").click(function(){
			$("#form").load("form.php")
		})
	</script>
    </tbody>

  </table>
</form>
<?php }
?>




</body>
</html>
